<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>简介</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="book.componere.html">« Componere</a></li>
      <li style="float: right;"><a href="componere.setup.html">安装/配置 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.componere.html">Componere</a></li>
    <li>简介</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="intro.componere" class="preface">
  <h1 class="title">简介</h1>
  <p class="para">
   Componere <sub class="subscript">(latin, English: compose)</sub> targets production environments and provides an API for 
   composition of classes, monkey patching, and casting.
  </p>
   <p class="formalpara">
    <h5 class="title">Composition:</h5>
    <p class="para">
     <span class="classname"><a href="class.componere-definition.html" class="classname">Componere\Definition</a></span> is used to define (or redefine) a class at runtime; 
     The class can then be registered, and in the case of redefinition it replaces the original class 
     for as long as the <span class="classname"><a href="class.componere-definition.html" class="classname">Componere\Definition</a></span> exists.
     <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="componere-definition.construct.html" class="methodname">Componere\Definition::__construct</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>)</div>
<div class="constructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="componere-definition.construct.html" class="methodname">Componere\Definition::__construct</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$parent</code></span>)</div>
<div class="constructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="componere-definition.construct.html" class="methodname">Componere\Definition::__construct</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$interfaces</code></span>)</div>
<div class="constructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="componere-definition.construct.html" class="methodname">Componere\Definition::__construct</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$parent</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$interfaces</code></span>)</div>

    </p>
   </p>

   <p class="formalpara">
    <h5 class="title">Patching:</h5>
    <p class="para">
     <span class="classname"><a href="class.componere-patch.html" class="classname">Componere\Patch</a></span> is used to change the class of a specific instance of an object at runtime; 
     Upon application the patch will remain applied for as long as the <span class="classname"><a href="class.componere-patch.html" class="classname">Componere\Patch</a></span> exists, and can be reverted explicitly.
     <div class="constructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="componere-patch.construct.html" class="methodname">Componere\Patch::__construct</a></span>(<span class="methodparam"><span class="type">object</span> <code class="parameter">$instance</code></span>)</div>
<div class="constructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="componere-patch.construct.html" class="methodname">Componere\Patch::__construct</a></span>(<span class="methodparam"><span class="type">object</span> <code class="parameter">$instance</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$interfaces</code></span>)</div>

    </p>
  </p>

  <p class="formalpara">
    <h5 class="title">Casting:</h5>
    <p class="para">
     <span class="classname"><strong class="classname">Componere\</strong></span> casting functions can cast among user defined compatible types;
     Where compatible means <span class="classname"><strong class="classname">Type</strong></span> is sub or super to the type of <code class="parameter">object</code>.
     <div class="methodsynopsis dc-description"><span class="methodname"><a href="componere.cast.html" class="methodname">Componere\cast</a></span>(<span class="methodparam"><span class="type"><span class="type Type">Type</span></span> <code class="parameter">$type</code></span>, <span class="methodparam"> <code class="parameter">$object</code></span>): <span class="type"><span class="type Type">Type</span></span></div>

     <div class="methodsynopsis dc-description"><span class="methodname"><a href="componere.cast_by_ref.html" class="methodname">Componere\cast_by_ref</a></span>(<span class="methodparam"><span class="type"><span class="type Type">Type</span></span> <code class="parameter">$type</code></span>, <span class="methodparam"> <code class="parameter">$object</code></span>): <span class="type"><span class="type Type">Type</span></span></div>

    </p>
  </p>

 </div></div></div></body></html>